﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dataglot.Utils;

namespace Dataglot.Odbc
{
    //Yes this is some ill thougt out internationalization.
    public enum OdbcDriver
    {
        None = 0,
        SqlServer = 1,
        MicrosoftOdbcforOracle = 2,
        MicrosoftAccessDriver = 3,
        MicrosoftAccessTreiber = 4,
        DriverdoMicrosoftAccess = 5,
        MicrosoftdBaseDriver = 6,
        MicrosoftdBaseTreiber = 7,
        DriverdoMicrosoftdBase = 8,
        MicrosoftExcelDriver = 9,
        MicrosoftExcelTreiber = 10,
        DriverdoMicrosoftExcel = 11,
        MicrosoftParadoxDriver = 12,
        MicrosoftParadoxTreiber = 13,
        DriverdoMicrosoftParadox = 14,
        MicrosoftTextDriver = 15,
        MicrosoftTextTreiber = 16,
        DriverdaMicrosoftparaarquivostexto = 17,
        MicrosoftVisualFoxProDriver = 18,
        MicrosoftFoxProVfpDriver = 19,
        MicrosoftdBaseVfpDriver = 20,
        MicrosoftVisualFoxProTreiber = 21,
        DriverparaoMicrosoftVisualFoxPro = 22,
        SqlNativeClient = 23,
        SqlServerNativeClient110 = 24
    }

    public class OdbcConnectionMaker
    {
        public DataFactory Make(OdbcDriver targetDriver, string connectionString)
        {
            TraceApp.Verbose(() => "Creating an ODBC factory : " + targetDriver);
            //targetOdbc = targetDriver;
            //brand = DbBrand.Odbc;
            //odbcConnectionString = connectionString;
            //TODO: convert to oledb?
            //TODO: convert to native?
            return new DataFactory();
        }

               /// <summary>
        /// Client specifies everything
        /// </summary>
         public DataFactory Make(string oleDbString, string providerName, DbBrand targetBrand, string odbcString, OdbcDriver target, string nativeString)
        {
            TraceApp.Verbose(() => "Creating an factory where everything is specified");

            //targetOdbc = target;
            //oleDbConnectionString = oleDbString;
            //odbcConnectionString = odbcString;
            //nativeConnectionString = nativeString;
            //brand = targetBrand;
            //provider = DbProviderFactories.GetFactory(providerName);

            //We can recover an oledb or native string if one is missing.
            //if (!String.IsNullOrEmpty(nativeString) && oleDbConnectionString == null
            //    && (brand == DbBrand.MsSql2000 || brand == DbBrand.MsSql2005))
            //{
            //    oleDbConnectionString = ConvertNativeSqlToOleDb(nativeString);
            //}

            //If the odbc string is missing, we might be able to recover the other if we interogate the DSN

            //ConvertProvidertoBrand(providerName);
             return new DataFactory();
        }
    }
}
